<?php

namespace app\teacher\model;

use think\Model;

class TeacherImage extends Model
{
    protected $autoWriteTimestamp = false;

    /**
     * 添加图片
     */
    public static function add($teacherId, array $images)
    {
        $data = [];
        foreach ($images as $val) {
            $data[] = [
                'teacher_id' => $teacherId,
                'image' => $val
            ];
        }
        return self::insertAll($data);
    }

    /**
     * 删除教师图片
     */
    public static function deleteImage($teacherId)
    {
        return self::where('teacher_id', $teacherId)->delete();
    }
}
